From: Debian Qt/KDE Maintainers Date: Sun, 2 Aug 2020 08:49:03 +0000 (+0100) Subject: moc: handle include directives in enums X-Git-Tag: archive/raspbian/5.14.2+dfsg-5+rpi1^2~13 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c78baf3c2f0c9b7ac5264e0a12cfd6ec76752df6;p=qtbase-opensource-src.git moc: handle include directives in enums Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=98cb33115089eebc Last-Update: 2020-06-29 When including files, moc inserts a MOC_INCLUDE_BEGIN and MOC_INCLUDE_END token into the token stream. Those are already handled in the toplevel Moc::parse function, but parseEnum lacked support so far. Gbp-Pq: Name moc_handle_includes.diff --- diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 50946443b..51c468ea7 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -280,11 +280,21 @@ bool Moc::parseEnum(EnumDef *def) } if (!test(LBRACE)) return false; + auto handleInclude = [this]() { + if (test(MOC_INCLUDE_BEGIN)) + currentFilenames.push(symbol().unquotedLexem()); + if (test(NOTOKEN)) { + next(MOC_INCLUDE_END); + currentFilenames.pop(); + } + }; do { if (lookup() == RBRACE) // accept trailing comma break; + handleInclude(); next(IDENTIFIER); def->values += lexem(); + handleInclude(); skipCxxAttributes(); } while (test(EQ) ? until(COMMA) : test(COMMA)); next(RBRACE);